package top.wettis.chat.controller;

import cn.dev33.satoken.stp.StpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.wettis.chat.pojo.DO.Objectives;
import top.wettis.chat.pojo.Query.GetAccont1;
import top.wettis.chat.service.IObjectivesService;
import top.wettis.chat.service.ITaskService;
import top.wettis.chat.service.IUserService;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/chat")
public class NewPlanCotrller {

    @Autowired
    private IObjectivesService iObjectivesService;

    @Autowired
    private ITaskService iTaskService;

    @Autowired

    private IUserService iUserService;

    @GetMapping("/get1")
    public List<Objectives> get1(@RequestParam("level") String level){
        int user_id = StpUtil.getLoginIdAsInt();
        int cur_levl = Integer.parseInt(level);
        return iObjectivesService.selectByli(user_id, cur_levl);
    }

    @GetMapping("/get2")
    public GetAccont1 get1(){
        int user_id = StpUtil.getLoginIdAsInt();
        return iObjectivesService.get2(user_id);
    }

    @GetMapping("/get3")
    public Integer get3(){
        int user_id = StpUtil.getLoginIdAsInt();;
        return iUserService.get3(user_id);
//        return 1;
    }
}
